package com.vatsalya.bakthi.yoga;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.vatsalya.bakthi.yoga.R;
import com.vatsalya.bakthi.yoga.services.MusicBackgroundService;

public class MainActivity extends Activity {
	
	//

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		TextView playingTextView = (TextView)findViewById(R.id.ctrack);
		Button stopButton  = (Button)findViewById(R.id.stpbtn);
		if(MusicBackgroundService.IsServiceRunning()){
			playingTextView.setText(MusicBackgroundService.currentlyPlayingTrack());
			playingTextView.setVisibility(View.VISIBLE);
			stopButton.setVisibility(View.VISIBLE);
		}else{
			playingTextView.setVisibility(View.INVISIBLE);
			stopButton.setVisibility(View.INVISIBLE);
		}
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}

	@Override
	public void onResume(){
		super.onResume();
	}

	//On mantras button click
	public void onMantrasClick(View view){
		Intent intent = new Intent(this, MantrasListActivity.class);
		startActivity(intent);
	}
	
	
	public void onAlarmClick(View view){
		Intent intent = new Intent(this, AlarmSettingsActivity.class);
		startActivity(intent);
	}

	public void stopClick(View view){
		stopService(new Intent(this, MusicBackgroundService.class));
		TextView playingTextView = (TextView)findViewById(R.id.ctrack);
		Button stopButton  = (Button)findViewById(R.id.stpbtn);

		playingTextView.setVisibility(View.INVISIBLE);
		stopButton.setVisibility(View.INVISIBLE);

	}


}
